Optimal. Leaf size=138 \[ \frac {(a+3 b) x}{2 (a-b)^3}-\frac {\sqrt {b} (3 a+b) \text {ArcTan}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{2 \sqrt {a} (a-b)^3 f}-\frac {\cos (e+f x) \sin (e+f x)}{2 (a-b) f \left (a+b \tan ^2(e+f x)\right )}-\frac {b \tan (e+f x)}{(a-b)^2 f \left (a+b \tan ^2(e+f x)\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.11, antiderivative size = 138, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {3744, 482, 541,
536, 209, 211} \begin {gather*} -\frac {\sqrt {b} (3 a+b) \text {ArcTan}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{2 \sqrt {a} f (a-b)^3}-\frac {b \tan (e+f x)}{f (a-b)^2 \left (a+b \tan ^2(e+f x)\right )}-\frac {\sin (e+f x) \cos (e+f x)}{2 f (a-b) \left (a+b \tan ^2(e+f x)\right )}+\frac {x (a+3 b)}{2 (a-b)^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 211
Rule 482
Rule 536
Rule 541
Rule 3744
Rubi steps
\begin {align*} \int \frac {\sin ^2(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx &=\frac {\text {Subst}\left (\int \frac {x^2}{\left (1+x^2\right )^2 \left (a+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {\cos (e+f x) \sin (e+f x)}{2 (a-b) f \left (a+b \tan ^2(e+f x)\right )}+\frac {\text {Subst}\left (\int \frac {a-3 b x^2}{\left (1+x^2\right ) \left (a+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{2 (a-b) f}\\ &=-\frac {\cos (e+f x) \sin (e+f x)}{2 (a-b) f \left (a+b \tan ^2(e+f x)\right )}-\frac {b \tan (e+f x)}{(a-b)^2 f \left (a+b \tan ^2(e+f x)\right )}+\frac {\text {Subst}\left (\int \frac {2 a (a+b)-4 a b x^2}{\left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{4 a (a-b)^2 f}\\ &=-\frac {\cos (e+f x) \sin (e+f x)}{2 (a-b) f \left (a+b \tan ^2(e+f x)\right )}-\frac {b \tan (e+f x)}{(a-b)^2 f \left (a+b \tan ^2(e+f x)\right )}-\frac {(b (3 a+b)) \text {Subst}\left (\int \frac {1}{a+b x^2} \, dx,x,\tan (e+f x)\right )}{2 (a-b)^3 f}+\frac {(a+3 b) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{2 (a-b)^3 f}\\ &=\frac {(a+3 b) x}{2 (a-b)^3}-\frac {\sqrt {b} (3 a+b) \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{2 \sqrt {a} (a-b)^3 f}-\frac {\cos (e+f x) \sin (e+f x)}{2 (a-b) f \left (a+b \tan ^2(e+f x)\right )}-\frac {b \tan (e+f x)}{(a-b)^2 f \left (a+b \tan ^2(e+f x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.17, size = 111, normalized size = 0.80 \begin {gather*} -\frac {-2 (a+3 b) (e+f x)+\frac {2 \sqrt {b} (3 a+b) \text {ArcTan}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{\sqrt {a}}+(a-b) \sin (2 (e+f x))+\frac {2 (a-b) b \sin (2 (e+f x))}{a+b+(a-b) \cos (2 (e+f x))}}{4 (a-b)^3 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.34, size = 120, normalized size = 0.87
method | result | size |
derivativedivides | \(\frac {\frac {\frac {\left (-\frac {a}{2}+\frac {b}{2}\right ) \tan \left (f x +e \right )}{1+\tan ^{2}\left (f x +e \right )}+\frac {\left (a +3 b \right ) \arctan \left (\tan \left (f x +e \right )\right )}{2}}{\left (a -b \right )^{3}}-\frac {b \left (\frac {\left (\frac {a}{2}-\frac {b}{2}\right ) \tan \left (f x +e \right )}{a +b \left (\tan ^{2}\left (f x +e \right )\right )}+\frac {\left (3 a +b \right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {a b}}\right )}{2 \sqrt {a b}}\right )}{\left (a -b \right )^{3}}}{f}\) | \(120\) |
default | \(\frac {\frac {\frac {\left (-\frac {a}{2}+\frac {b}{2}\right ) \tan \left (f x +e \right )}{1+\tan ^{2}\left (f x +e \right )}+\frac {\left (a +3 b \right ) \arctan \left (\tan \left (f x +e \right )\right )}{2}}{\left (a -b \right )^{3}}-\frac {b \left (\frac {\left (\frac {a}{2}-\frac {b}{2}\right ) \tan \left (f x +e \right )}{a +b \left (\tan ^{2}\left (f x +e \right )\right )}+\frac {\left (3 a +b \right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {a b}}\right )}{2 \sqrt {a b}}\right )}{\left (a -b \right )^{3}}}{f}\) | \(120\) |
risch | \(\frac {x a}{2 \left (a^{2}-2 a b +b^{2}\right ) \left (a -b \right )}+\frac {3 x b}{2 \left (a^{2}-2 a b +b^{2}\right ) \left (a -b \right )}+\frac {i {\mathrm e}^{2 i \left (f x +e \right )}}{8 \left (a^{2}-2 a b +b^{2}\right ) f}-\frac {i {\mathrm e}^{-2 i \left (f x +e \right )}}{8 \left (a^{2}-2 a b +b^{2}\right ) f}-\frac {i b \left (a \,{\mathrm e}^{2 i \left (f x +e \right )}+b \,{\mathrm e}^{2 i \left (f x +e \right )}+a -b \right )}{f \left (-a +b \right )^{3} \left (-a \,{\mathrm e}^{4 i \left (f x +e \right )}+b \,{\mathrm e}^{4 i \left (f x +e \right )}-2 a \,{\mathrm e}^{2 i \left (f x +e \right )}-2 b \,{\mathrm e}^{2 i \left (f x +e \right )}-a +b \right )}-\frac {3 \sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-a b}-a -b}{a -b}\right )}{4 \left (a -b \right )^{3} f}-\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-a b}-a -b}{a -b}\right ) b}{4 a \left (a -b \right )^{3} f}+\frac {3 \sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-a b}+a +b}{a -b}\right )}{4 \left (a -b \right )^{3} f}+\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-a b}+a +b}{a -b}\right ) b}{4 a \left (a -b \right )^{3} f}\) | \(415\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.50, size = 191, normalized size = 1.38 \begin {gather*} \frac {\frac {{\left (f x + e\right )} {\left (a + 3 \, b\right )}}{a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}} - \frac {{\left (3 \, a b + b^{2}\right )} \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b}}\right )}{{\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} \sqrt {a b}} - \frac {2 \, b \tan \left (f x + e\right )^{3} + {\left (a + b\right )} \tan \left (f x + e\right )}{{\left (a^{2} b - 2 \, a b^{2} + b^{3}\right )} \tan \left (f x + e\right )^{4} + a^{3} - 2 \, a^{2} b + a b^{2} + {\left (a^{3} - a^{2} b - a b^{2} + b^{3}\right )} \tan \left (f x + e\right )^{2}}}{2 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.65, size = 590, normalized size = 4.28 \begin {gather*} \left [\frac {4 \, {\left (a^{2} + 2 \, a b - 3 \, b^{2}\right )} f x \cos \left (f x + e\right )^{2} + 4 \, {\left (a b + 3 \, b^{2}\right )} f x - {\left ({\left (3 \, a^{2} - 2 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} + 3 \, a b + b^{2}\right )} \sqrt {-\frac {b}{a}} \log \left (\frac {{\left (a^{2} + 6 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{4} - 2 \, {\left (3 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{2} - 4 \, {\left ({\left (a^{2} + a b\right )} \cos \left (f x + e\right )^{3} - a b \cos \left (f x + e\right )\right )} \sqrt {-\frac {b}{a}} \sin \left (f x + e\right ) + b^{2}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{4} + 2 \, {\left (a b - b^{2}\right )} \cos \left (f x + e\right )^{2} + b^{2}}\right ) - 4 \, {\left ({\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{3} + 2 \, {\left (a b - b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{8 \, {\left ({\left (a^{4} - 4 \, a^{3} b + 6 \, a^{2} b^{2} - 4 \, a b^{3} + b^{4}\right )} f \cos \left (f x + e\right )^{2} + {\left (a^{3} b - 3 \, a^{2} b^{2} + 3 \, a b^{3} - b^{4}\right )} f\right )}}, \frac {2 \, {\left (a^{2} + 2 \, a b - 3 \, b^{2}\right )} f x \cos \left (f x + e\right )^{2} + 2 \, {\left (a b + 3 \, b^{2}\right )} f x + {\left ({\left (3 \, a^{2} - 2 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} + 3 \, a b + b^{2}\right )} \sqrt {\frac {b}{a}} \arctan \left (\frac {{\left ({\left (a + b\right )} \cos \left (f x + e\right )^{2} - b\right )} \sqrt {\frac {b}{a}}}{2 \, b \cos \left (f x + e\right ) \sin \left (f x + e\right )}\right ) - 2 \, {\left ({\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{3} + 2 \, {\left (a b - b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{4 \, {\left ({\left (a^{4} - 4 \, a^{3} b + 6 \, a^{2} b^{2} - 4 \, a b^{3} + b^{4}\right )} f \cos \left (f x + e\right )^{2} + {\left (a^{3} b - 3 \, a^{2} b^{2} + 3 \, a b^{3} - b^{4}\right )} f\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.78, size = 195, normalized size = 1.41 \begin {gather*} \frac {\frac {{\left (f x + e\right )} {\left (a + 3 \, b\right )}}{a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}} - \frac {{\left (\pi \left \lfloor \frac {f x + e}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (b\right ) + \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b}}\right )\right )} {\left (3 \, a b + b^{2}\right )}}{{\left (a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}\right )} \sqrt {a b}} - \frac {2 \, b \tan \left (f x + e\right )^{3} + a \tan \left (f x + e\right ) + b \tan \left (f x + e\right )}{{\left (b \tan \left (f x + e\right )^{4} + a \tan \left (f x + e\right )^{2} + b \tan \left (f x + e\right )^{2} + a\right )} {\left (a^{2} - 2 \, a b + b^{2}\right )}}}{2 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 14.94, size = 2500, normalized size = 18.12 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________